CSS (Cascading Style Sheets) is a stylesheet language used to control the presentation and layout of HTML documents. It separates structure (HTML) from design, making web pages easier to maintain and more visually appealing.
style attribute.<style> tag within the <head> section..css file and linked using <link>. Best practice for scalability.A CSS rule consists of a selector and a declaration block:
selector {
property: value;
}
Example:
p {
color: blue;
font-size: 16px;
}
* { ... }p { ... }.classname { ... }#idname { ... }h1, h2, p { ... }div p { ... }a:hover { ... }CSS has a wide range of properties to style elements, such as:
color, font-size, text-align, line-heightmargin, border, padding, width, heightbackground-color, background-imagestatic, relative, absolute, fixed, stickyThe box model defines how elements are rendered as rectangular boxes:
CSS supports responsive layouts using:
@media (max-width: 600px) { ... }em, rem, %, vw, vh@keyframes for custom effects.--main-color: #333;